using Circus.CodeEditor;
using System;
using System.ComponentModel;
using System.Drawing;
namespace Circus.CodeEditor.TextSource
{
	public class BookMark : IBookMark
	{
		private int line;
		private int pos;
		private int index;
		private string name = string.Empty;
		private string description = string.Empty;
		private string url = string.Empty;
		private string fileName = string.Empty;
		private int imageIndex = -1;
		private int group = 0;
		private int zIndex = 0;
		private object tag = null;
		[Description("Gets position of the bookmark within the text. 0 corresponds to the first line, 1 to second the line, and so on.")]
		public virtual int Line
		{
			get
			{
				return this.line;
			}
		}
		[Description("Gets position of the bookmark within the text line. 0 corresponds to the first character in a line, 1 to the second character, and so on.")]
		public virtual int Pos
		{
			get
			{
				return this.pos;
			}
		}
		[Description("Gets an integer value that specifies ordinal number of the bookmark.")]
		public virtual int Index
		{
			get
			{
				return this.index;
			}
		}
		[Description("Gets or sets position of the bookmark within the text (index of character and line). Corresponds to \"Pos\" and \"Line\" properties.")]
		public virtual Point Position
		{
			get
			{
				return new Point(this.pos, this.line);
			}
			set
			{
				this.pos = value.X;
				this.line = value.Y;
			}
		}
		[Description("Gets or sets name of the bookmark.")]
		public virtual string Name
		{
			get
			{
				return this.name;
			}
			set
			{
				if (this.name != value)
				{
					this.name = value;
					this.OnNameChanged();
				}
			}
		}
		[Description("Gets or sets bookmark description.")]
		public virtual string Description
		{
			get
			{
				return this.description;
			}
			set
			{
				if (this.description != value)
				{
					this.description = value;
					this.OnDescriptionChanged();
				}
			}
		}
		[Description("Gets or sets bookmark url.")]
		public virtual string Url
		{
			get
			{
				return this.url;
			}
			set
			{
				if (this.url != value)
				{
					this.url = value;
					this.OnUrlChanged();
				}
			}
		}
		[Description("Gets or sets an FileName associated with this bookmark")]
		public virtual string FileName
		{
			get
			{
				return this.fileName;
			}
			set
			{
				if (this.fileName != value)
				{
					this.fileName = value;
					this.OnFileNameChanged();
				}
			}
		}
		[Description("Gets or sets an image index associated with this bookmark")]
		public virtual int ImageIndex
		{
			get
			{
				return this.imageIndex;
			}
			set
			{
				if (this.imageIndex != value)
				{
					this.imageIndex = value;
					this.OnImageIndexChanged();
				}
			}
		}
		public virtual int Group
		{
			get
			{
				return this.group;
			}
			set
			{
				if (this.group != value)
				{
					this.group = value;
					this.OnGroupChanged();
				}
			}
		}
		public virtual int ZIndex
		{
			get
			{
				return this.zIndex;
			}
			set
			{
				if (this.zIndex != value)
				{
					this.zIndex = value;
					this.OnZIndexChanged();
				}
			}
		}
		[Description("Gets or sets user-defined data associated with this bookmark")]
		public virtual object Tag
		{
			get
			{
				return this.tag;
			}
			set
			{
				if (this.tag != value)
				{
					this.tag = value;
					this.OnTagChanged();
				}
			}
		}
	
		protected virtual void OnDescriptionChanged()
		{
		}
		protected virtual void OnUrlChanged()
		{
		}
		protected virtual void OnNameChanged()
		{
		}
		protected virtual void OnFileNameChanged()
		{
		}
		protected virtual void OnImageIndexChanged()
		{
		}
		protected virtual void OnGroupChanged()
		{
		}
		protected virtual void OnZIndexChanged()
		{
		}
		protected virtual void OnTagChanged()
		{
		}
		public BookMark(int line)
		{
			this.line = line;
		}
		public BookMark(int line, int pos, int index)
		{
			this.line = line;
			this.pos = pos;
			this.index = index;
		}
		public BookMark() : this(0, 0, 0, string.Empty, string.Empty, string.Empty)
		{
		}
		public BookMark(int line, int pos, int index, string name, string description, string url) : this(line, pos, index)
		{
			this.name = name;
			this.description = description;
			this.url = url;
		}
		public BookMark(int line, int pos, int index, string name, string description, string url, int imageIndex, string fileName, object tag) : this(line, pos, index)
		{
			this.name = name;
			this.description = description;
			this.url = url;
			this.imageIndex = imageIndex;
			this.fileName = fileName;
			this.tag = tag;
		}
		public BookMark(int line, int pos, int index, int group, int imageIndex, string fileName) : this(line, pos, index, string.Empty, string.Empty, string.Empty)
		{
			this.FileName = fileName;
			this.ImageIndex = imageIndex;
			this.Group = group;
		}
		public BookMark(int line, int pos, int group, int index, int imageIndex, string name, string description, string url, string fileName, object tag) : this(line, pos, index, name, description, url, -1, fileName, tag)
		{
			this.FileName = fileName;
			this.Group = group;
			this.ImageIndex = imageIndex;
		}
		public BookMark(int line, string fileName) : this(line, 0, 0, string.Empty, string.Empty, string.Empty)
		{
			this.FileName = fileName;
		}
		public virtual void Assign(IBookMark source)
		{
			this.line = source.Line;
			this.pos = source.Pos;
			this.index = source.Index;
			this.Name = source.Name;
			this.Description = source.Description;
			this.Url = source.Url;
			this.FileName = source.FileName;
			this.ImageIndex = source.ImageIndex;
			this.Group = source.Group;
			this.ZIndex = source.ZIndex;
			this.Tag = source.Tag;
		}
		public bool ShouldSerializeLine()
		{
			return this.line != 0;
		}
		public bool ShouldSerializePos()
		{
			return this.pos != 0;
		}
		public bool ShouldSerializeIndex()
		{
			return this.index != 0;
		}
		public bool ShouldSerializeName()
		{
			return this.name != string.Empty;
		}
		public bool ShouldSerializeDescription()
		{
			return this.description != string.Empty;
		}
		public bool ShouldSerializeUrl()
		{
			return this.url != string.Empty;
		}
		public bool ShouldSerializeGroup()
		{
			return this.group != -1;
		}
		public bool ShouldSerializeImageIndex()
		{
			return this.imageIndex != -1;
		}
		public bool ShouldSerializeFileName()
		{
			return this.fileName != string.Empty;
		}
		public bool ShouldSerializeZIndex()
		{
			return this.zIndex != 0;
		}
	}
}
